package com.wanjia.seal.manager.utils;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;

/**
 * Json格式的数据进行响应
 */

public class JsonResult<E> implements Serializable {
    /*状态码*/
    private Integer state;
    /*描述信息*/
    private String message;
    /*数据*/
    //@JsonInclude(NON_NULL)
    private E data;


    public JsonResult() {
    }

    public JsonResult(Integer state) {
        this.state = state;
        this.message="";
    }

    public JsonResult(Throwable e) {

        this.message = e.getMessage();
    }

    public JsonResult(Integer state, E data) {
        this.state = state;
        this.data = data;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getMessage() {

        return message;
    }

    public void setMessage(String message) {
            this.message = message;
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }
}
